[PHP] MySql Proccesslist filled with "Sleep" Entries leading to "To many Connections" ?
Posted
by edorian
on Stack Overflow
See other posts from Stack Overflow
or by edorian
Published on 2010-03-09T09:02:57Z
Indexed on
2010/03/09
9:06 UTC
Read the original article
Hit count: 180
Hi,
i'd like to ask your help on a longstanding issue with php/mysql connections.
Every time i execute a "SHOW PROCESSLIST" command it shows me about 400 idle (Status: Sleep) connections to the database Server emerging from our 5 Webservers.
That never was much of a problem (and i didn't find a quick solution) until recently traffic numbers increased and since then MySql reports the "to many connections" Problems repeatedly, even so 350+ of those connections are in "sleep" state. Also a server can't get a mysql connection even if there are sleeping connection to that same server.
All those connections vanish when a apache server is restated.
The PHP Code used to create the Database connections uses the normal "mysql" Module, the "mysqli" Module, PEAR::DB and Zend Framework Db Adapter. (Different projects). NONE of the projects uses persistent connections.
Raising the connection-limit is possible but doesn't seem like a good solution since it's 450 now and there are only 20-100 "real" connections at a time anyways.
My question:
Why are there so many connections in sleep state and how can i prevent that.
Thank you for your time, if theres anything unclear or missing please let me know
© Stack Overflow or respective owner